In storage area networks, an N member zone may need N*(N−1) ternary content-addressable memory (“TCAM”) entries to support hard zoning. In general, the communication will not happen among targets or among initiators. Occasionally, there will be exceptions, such as when array ports (normally targets) must communicate with each other to perform array-based replication. There is a need for a way to optimize the TCAM spaces needed for zoning by not programming entries between two hosts or between two targets based on consideration of the device types.